@extends('admin.layout')
@section('title', $title)

@section('content');

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                用户管理
                <small>在这里你可以编辑用户</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{{ url('/admin/index') }}"><i class="fa fa-dashboard"></i> 主页</a></li>
                <li><a href="{{ url('/admin/user/index') }}">用户管理</a></li>
                <li class="active">编辑用户</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title">快速编辑用户</h3>
                        </div><!-- /.box-header -->
                        <!-- form start -->
                        <form role="form" action="{{url('/admin/user/update')}}" method="post" enctype="multipart/form-data">
                            {{csrf_field()}}
                            <div class="box-body">
                            @if (count($errors) > 0)
                                <div class="alert alert-danger">
                                    <ul>
                                        @foreach ($errors->all() as $error)
                                            <li>{{ $error }}</li>
                                        @endforeach
                                    </ul>
                                </div>
                            @endif
                            <input type="hidden" name="id" value="{{ $data -> id }}">

                                <div class="form-group">
                                    <label for="exampleInputEmail1">用户名</label>
                                    <input type="text" name="name" value="{{empty(old('name'))?$data->name:old('name') }}" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入用户名">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">密码</label>
                                    <input type="password" name="password" value="" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入密码">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">确认密码</label>
                                    <input type="password" name="repassword" value="" class="form-control" id="exampleInputEmail1"
                                           placeholder="请再次输入密码">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">邮箱</label>
                                    <input type="email" name="email" value="{{empty(old('email'))?$data->email:old('email') }}" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入邮箱">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputEmail1">手机</label>
                                    <input type="text" name="phone" value="{{empty(old('phone'))?$data->phone:old('phone') }}" class="form-control" id="exampleInputEmail1"
                                           placeholder="请输入手机号">
                                </div>
                                <div class="form-group">
                                    <label for="exampleInputFile">头像</label>
                                    <input type="file" name="pic" id="exampleInputFile">
                                    <p></p>
                                    <p><img width="100px" height="100px" src="{{ $data -> pic }}" alt=""></p>
                                    <p class="help-block">请选择一张靓照,作为头像</p>
                                </div>
                            </div><!-- /.box-body -->

                            <div class="box-footer">
                                <button type="submit" class="btn btn-primary">更新</button>
                            </div>
                        </form>
                    </div><!-- /.box -->
                </div><!--/.col (left) -->
            </div>   <!-- /.row -->
        </section><!-- /.content -->
    </div><!-- /.content-wrapper -->
    <script type="text/javascript">
    window.onload = function(){
        $("#info").fadeOut(3000);
    }
    </script>
@endsection